package mylibrary.thread.synchronize;

public class BankSaving {

	private static int money = 1000;
	public void add(int i) {
		money = money + i;
		System.out.println("Husband 向银行存入了 " + i);
	}
	
	public void get(int i) {
		money = money - i;
		System.out.println("Wife 向银行取出了 " + i);
		
		if(money < 0) {
			System.out.println("余额不足");
		}
	}
	
	public int showMoney() {
		
		return money;
	}
}
